<template>
  <div id="app">
    <v-header :seller="seller"></v-header>
    <div class="tab border-1px">
      <div class="tab_item">
        <router-link to="/goods">商品</router-link>
      </div>
      <div class="tab_item">
        <router-link to="/ratings">评论</router-link>
      </div>
      <div class="tab_item">
        <router-link to="/seller">商家</router-link>
      </div>
    </div>
    <keep-alive>
      <router-view :seller="seller"></router-view>
    </keep-alive>
  </div>
</template>

<script>
  import Header from './components/header/Header'

  const ERR_OK = 0;

  export default {
    name: 'App',
    data() {
      return {
        seller: {}
      };
    },
    created() {
      this.$http.get('/api/seller').then(res => {
        let response = res.body;
        if (response.errno === ERR_OK) {
          this.seller = response.data;
        }
      });
    },
    methods: {},
    components: {
      'v-header': Header
    }
  }
</script>
<style lang="less" type="text/less">
  @import "common/less/mixin";

  #app {
    .tab {
      display: flex;
      width: 100%;
      height: 40px;
      line-height: 40px;
      border-bottom: 1px solid rgba(7, 17, 27, .1);

      .tab_item {
        flex: 1;
        text-align: center;

        & > a {
          display: block; //默认的inline的话只有点击到文字才会跳转
          font-size: 14px;
          /*color: rgb(77, 85, 93);*/
          .border-1px(rgb(77, 85, 93));

          &.active {
            color: rgb(240, 20, 20);
          }
        }
      }
    }
  }
</style>
